﻿namespace A12_Ex01_5
{
    public class Program
    {
        private static int m_NumOfLowerCase = 0;
        private static int m_NumOfUpperCase = 0;
        private static int m_NumOfDigits = 0;
        private static int m_NumOfWhiteSpace = 0;

        public static void Main()
        {
            System.Console.WriteLine("Please enter text to check:");
            string userInputStr = System.Console.ReadLine();
            generateStatistics(userInputStr);
            string statisticsMessage = string.Format(
                                                     "Number of lower case entered: {1}{0}Number of upper case entered: {2}{0}Number of digits entered: {3}{0}Number of white space entered: {4}{0}",
                                                     System.Environment.NewLine,
                                                     m_NumOfLowerCase,
                                                     m_NumOfUpperCase,
                                                     m_NumOfDigits,
                                                     m_NumOfWhiteSpace);
            System.Console.WriteLine(statisticsMessage);
        }

        private static void generateStatistics(string i_inputString)
        {
            for (int i = 0; i < i_inputString.Length; i++)
            {
                char currentCharToCheck = i_inputString[i];

                if (char.IsLower(currentCharToCheck))
                {
                    m_NumOfLowerCase++;
                }
                else if (char.IsUpper(currentCharToCheck))
                {
                    m_NumOfUpperCase++;
                }
                else if (char.IsDigit(currentCharToCheck))
                {
                    m_NumOfDigits++;
                }
                else if (char.IsWhiteSpace(currentCharToCheck))
                {
                    m_NumOfWhiteSpace++;
                }
            }
        }
    }
}
